package com.mzy.linear_struct.subject;

/**
 * @Author: mizy3
 * @Date: 2024/08/07/下午12:33
 * @Description:
 */
public class Pro27移除元素 {

    public int removeElement(int[] nums, int val) {
        int slow = 0;
        for (int fast = 0; fast < nums.length; fast++) {
            if(nums[fast] != val){
                nums[slow++] = nums[fast];
            }
        }
        return slow;
    }


    public static void main(String[] args) {
        System.out.println(new Pro27移除元素().removeElement(new int[]{3, 2, 2, 3}, 3));
    }
}
